import { createRouter, createWebHistory } from "vue-router";

export const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: "/",
      name: "Root",
      redirect: "/login",
    },
    {
      path: "/login",
      name: "Login",
      component: () => import("@/views/LoginView.vue"),
    },
    {
      path: "/forget-password",
      name: "ForgetPassword",
      component: () => import("@/views/ForgetPasswordView.vue"),
    },
    {
      path: "/register",
      name: "Register",
      component: () => import("@/views/RegisterView.vue"),
    },
    {
      path: "/home",
      name: "Home",
      component: () => import("@/views/HomePageView.vue"),
      redirect: "/home/default",
      children: [
        {
          path: "default",
          name: "Default",
          component: () =>
            import("@/components/HomePageContent/DefaultContent.vue"),
        },
        {
          path: "news-detail/:newsId/:newsTitle",
          name: "NewsDetail",
          component: () =>
            import("@/components/HomePageContent/NewsDetail.vue"),
        },
      ],
    },
    {
      path: "/profile",
      name: "Profile",
      component: () => import("@/views/ProfileView.vue"),
    },
    {
      path: "/:pathMatch(.*)*",
      name: "NotFound",
      component: () => import("@/views/PageNotFoundView.vue"),
    },
  ],
});
